import request from '@/utils/request'

export function getList (params) {
    return request({
        url: '/nsk/report/list',
        method: 'get',
        params
    })
}

// AI分析接口
export function aiAnalysis () {
    return request({
        url: '/nsk/workOrdersAi/AiAllocation',
        method: 'get'
    })
}

// 导出工单接口
export function exportWorkOrders (params) {
    return request({
        url: '/nsk/workOrdersAi/export?' + new URLSearchParams(params).toString(),
        method: 'post',
        responseType: 'blob'
    })
}

// 生成周报接口
export function generateWeekReport (formData, reportType, reportName) {
    return request({
        url: `/nsk/report/generateWeekReport?reportType=${encodeURIComponent(reportType)}&reportName=${encodeURIComponent(reportName)}`,
        method: 'post',
        data: formData
    })
}

// 生成月报接口
export function generateMonthReport (formData, reportType, reportName) {
    return request({
        url: `/nsk/report/generateMonthReport?reportType=${encodeURIComponent(reportType)}&reportName=${encodeURIComponent(reportName)}`,
        method: 'post',
        data: formData
    })
}

// 删除报告接口
export function deleteReport (ids) {
    return request({
        url: `/nsk/report/${ids}`,
        method: 'delete'
    })
}

// 下载报告接口
export function downloadReport (ossId) {
    return request({
        url: `/system/oss/download/${ossId}`,
        method: 'get',
        responseType: 'blob'
    })
}

// 暂存报告接口
export function saveReport (formData, reportType, reportName) {
    return request({
        url: `/nsk/report/save?reportType=${encodeURIComponent(reportType)}&reportName=${encodeURIComponent(reportName)}`,
        method: 'post',
        data: formData
    })
}

// 报告生成
export function generateReport (data) {
    return request({
        url: `/nsk/report/generateReport`,
        method: 'post',
        data
    })
}



